from rest_framework.serializers import ModelSerializer
from rest_framework import serializers
from django.contrib.auth.models import Group


class GroupSerializers(ModelSerializer):
    permissions_names = serializers.StringRelatedField(many=True,
                                                       required=False,
                                                       source="permissions")

    class Meta:
        model = Group
        fields = '__all__'
        extra_kwargs = {
            'permissions': {
                "write_only": True
            }
        }
